#include <rtthread.h>
#include <stdint.h>
#include "ch32f20x.h"

int usbhs_interrupt_enable(void)
{
    NVIC_EnableIRQ(USBHS_IRQn);
    return 0;
}
INIT_APP_EXPORT(usbhs_interrupt_enable);

void usb_dc_low_level_init(void)
{
    RCC_USBCLK48MConfig(RCC_USBCLK48MCLKSource_USBPHY);
    RCC_USBHSPLLCLKConfig(RCC_HSBHSPLLCLKSource_HSE);
    RCC_USBHSConfig(RCC_USBPLL_Div2);
    RCC_USBHSPLLCKREFCLKConfig(RCC_USBHSPLLCKREFCLK_4M);
    RCC_USBHSPHYPLLALIVEcmd(ENABLE);
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_USBHS, ENABLE);
}

void usb_dc_low_level_deinit(void)
{
}
